# -*- coding: utf-8 -*-
import scrapy
from by_scrapy.items import *

class BySpiderSpider(scrapy.Spider):
    name = 'by_spider'
    allowed_domains = ['bytravel.cn']
    start_urls = ['http://shop.bytravel.cn/']

    def parse(self, response):
        div_list = response.xpath("//div[@align='center']//div")

        for div in div_list:
            province = Province()
            distinct_list = []
            if div.xpath("./@class").extract_first() == 'ht':
                province['name'] = div.xpath(".//a/text()").extract_first()
                province['url'] = "http://shop.bytravel.cn" + div.xpath(".//a/@href").extract_first()
                yield scrapy.Request(
                    
                )
            

